package routers

import (
	"web/api"

	"github.com/gin-gonic/gin"
)

// SetupOrderRoutes 设置订单相关路由
func SetupOrderRoutes(r *gin.RouterGroup) {
	// 创建订单控制器实例（单例模式）
	orderController := api.NewOrderController()

	// 订单基础路由
	r.GET("/orders", orderController.List)
	r.GET("/order/:id", orderController.Show)
	r.POST("/order", orderController.Store)
	r.PUT("/order/:id", orderController.Update)
	r.DELETE("/order/:id", orderController.Delete)

	// 扩展路由
	r.GET("/order/no/:order_no", orderController.GetOrderByOrderNo)
	r.GET("/user/:uid/orders", orderController.GetUserOrders)
	r.GET("/order/uid/:uid", orderController.GetByUid)
	r.GET("/order/status/:status", orderController.GetByStatus)
}
